<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支付界面</title>
    <style>
        body {
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 20px;
            color: #333;
        }
        .payment-container {
            max-width: 500px;
            margin: 0 auto;
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 25px;
        }
        .amount-due {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }
        .amount-label {
            font-size: 16px;
            color: #666;
            margin-bottom: 5px;
        }
        .amount-value {
            font-size: 28px;
            font-weight: bold;
            color: #e4393c;
        }
        .payment-methods {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }
        .payment-method {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 15px 10px;
            border-radius: 8px;
            border: 1px solid #eee;
            cursor: pointer;
            transition: all 0.2s;
        }
        .payment-method:hover {
            border-color: #409EFF;
            box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
        }
        .payment-method.active {
            border-color: #409EFF;
            background-color: #f5faff;
        }
        .payment-icon {
            width: 40px;
            height: 40px;
            margin-bottom: 8px;
            object-fit: contain;
        }
        .payment-name {
            font-size: 14px;
            text-align: center;
        }
        .confirm-btn {
            display: block;
            width: 100%;
            padding: 12px;
            margin-top: 30px;
            background-color: #e4393c;
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .confirm-btn:hover {
            background-color: #d33437;
        }
        .confirm-btn:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }
    </style>
</head>
<body>
<div class="payment-container">
    <div class="amount-due">
        <div class="amount-label">应付金额</div>
        <div class="amount-value">20元</div>
    </div>

    <div class="payment-methods">

        <!-- 第三方支付 -->
        <div class="payment-method" onclick="selectPayment(this, 'unionpay')">
            <img src="../image/unionPay.png" alt="中国银联" class="payment-icon">
            <span class="payment-name">中国银联</span>
        </div>

    </div>

    <button class="confirm-btn" id="confirmBtn" disabled>确认支付</button>
</div>

<script>
    let selectedPayment = null;

    function selectPayment(element, paymentType) {
        // 移除所有active类
        document.querySelectorAll('.payment-method').forEach(item => {
            item.classList.remove('active');
        });

        // 为当前选中项添加active类
        element.classList.add('active');
        selectedPayment = paymentType;

        // 启用支付按钮
        document.getElementById('confirmBtn').disabled = false;
    }

    document.getElementById('confirmBtn').addEventListener('click', function() {
        if (!selectedPayment) return;

        // 这里添加支付逻辑
        alert(`正在通过 ${selectedPayment} 支付20元...`);
        // 实际项目中这里应该是调用支付API
    });
</script>
</body>
</html>